package com.da.javatest.niuke.baodian;

import java.util.HashMap;

/**
 * @author chenlida
 * @date 2020/10/18 13:20
 * @description
 */
public class C83AlphaMatrix {
    public int findAlphaMatrix(String[] dic, int n) {
        int result = 0;
        HashMap<String, Integer> map = new HashMap<>();

        for (String key : dic) {
            if (!map.containsKey(key)) {
                map.put(key, 1);
            } else {
                map.put(key, map.get(key) + 1);
            }
        }

        for (String key : map.keySet()) {
            result = Math.max(result, map.get(key) * key.length());
        }
        return result;
    }
}
